//#include "can_test.h"
////
//// Defines
////
//
////
//// Globals
////
//
//
//uint16_t txMsgData[10];
//uint32_t rxMsgData[8];
//
//
//__interrupt void canbISR(void);     // Receive interrupt for CAN-B.
//                                    // No Transmit interrupt for CAN-A
////
//// Main
////
//void can_test_init(void)
//{
//
//
//    //
//    // Configure GPIO pins for CANTX/CANRX
//    //
//    GPIO_setPinConfig(GPIO_12_CANTXB);
//    GPIO_setPinConfig(GPIO_17_CANRXB);
//
//
//    CAN_initModule(CANB_BASE);
//
//    //
//    // Set up the CAN bus bit rate to 500kHz for each module
//    // Refer to the Driver Library User Guide for information on how to set
//    // tighter timing control. Additionally, consult the device data sheet
//    // for more information about the CAN module clocking.
//    //
//    CAN_setBitRate(CANB_BASE, DEVICE_SYSCLK_FREQ, 500000, 20);
//
//
//
//
//    CAN_enableInterrupt(CANB_BASE, CAN_INT_IE0 | CAN_INT_ERROR |
//                           CAN_INT_STATUS);
//
//
//    //
//    // Initialize PIE and clear PIE registers. Disables CPU interrupts.
//    //
//    Interrupt_initModule();
//
//     //
//     // Initialize the PIE vector table with pointers to the shell Interrupt
//     // Service Routines (ISR).
//     //
//     Interrupt_initVectorTable();
//
//
//    //
//    // Enable Global Interrupt (INTM) and realtime interrupt (DBGM)
//    //
//
//
//    //
//    // Interrupts that are used in this example are re-mapped to
//    // ISR functions found within this file.
//    // This registers the interrupt handler in PIE vector table.
//    //
//    Interrupt_register(INT_CANB0, &canbISR);
//
//    //
//    // Enable the CAN-B interrupt signal
//    //
//    Interrupt_enable(INT_CANB0);
//
//    //
//    // Set GLBINT0_EN bit in CAN_GLB_INT_EN register
//    //
//    CAN_enableGlobalInterrupt(CANB_BASE, CAN_GLOBAL_INT_CANINT0);
//    //
//    // Start CAN module A operations
//    //
//    //
//     // Initialize the receive message object used for receiving CAN messages.
//     // Message Object Parameters:
//     //      CAN Module: A
//     //      Message Object ID Number: 1
//     //      Message Identifier: 0x1
//     //      Message Frame: Standard
//     //      Message Type: Receive
//     //      Message ID Mask: 0x0
//     //      Message Object Flags: None
//     //      Message Data Length: "Don't care" for a Receive mailbox
//     //
//     CAN_setupMessageObject(CANB_BASE, RX_MSG_OBJ_ID, 0x1,
//                            CAN_MSG_FRAME_STD, CAN_MSG_OBJ_TYPE_RX, 0,
//                            CAN_MSG_OBJ_RX_INT_ENABLE, MSG_DATARX_LENGTH);
//
//
//     CAN_setupMessageObject(CANB_BASE, TX_MSG_OBJ_ID, 0x1,
//                               CAN_MSG_FRAME_STD, CAN_MSG_OBJ_TYPE_TX, 1,
//                               CAN_MSG_OBJ_TYPE_TX, MSG_DATATX_LENGTH);
//     CAN_startModule(CANB_BASE);
//        txMsgData[0] = 0x01;
//        txMsgData[1] = 0x23;
//        txMsgData[2] = 0x45;
//        txMsgData[3] = 0x67;
//        txMsgData[4] = 0x89;
//        txMsgData[5] = 0xAB;
//        txMsgData[6] = 0xCD;
//        txMsgData[7] = 0xEF;
//        txMsgData[8] = 0xEF;
//        txMsgData[9] = 0xEF;
//
//    //
//
//
//}
//__interrupt void
//canbISR(void)
//{
//    uint32_t status;
//
//    //
//    // Read the CAN-B interrupt status (in the CAN_INT register) to find the
//    // cause of the interrupt
//    //
//    status = CAN_getInterruptCause(CANB_BASE);
//
//    //
//    // If the cause is a controller status interrupt, then get the status.
//    // During first iteration of every ISR execution, status = 0x8000,
//    // which simply means CAN_ES != 0x07.
//    //
//    if(status == CAN_INT_INT0ID_STATUS)
//    {
//        //
//        // Read the controller status.  This will return a field of status
//        // error bits that can indicate various errors.  Error processing
//        // is not done in this example for simplicity.  Refer to the
//        // API documentation for details about the error status bits.
//        // The act of reading this status will clear the interrupt.
//        //
//        status = CAN_getStatus(CANB_BASE);  // Return CAN_ES value.
//        //
//        // Now status = 0x00000010, indicating RxOK.
//        //
//
//        //
//        // Check to see if an error occurred.
//        //
//        if(((status  & ~(CAN_STATUS_RXOK)) != CAN_STATUS_LEC_MSK) &&
//           ((status  & ~(CAN_STATUS_RXOK)) != CAN_STATUS_LEC_NONE))
//        {
//            //
//            // Set a flag to indicate some errors may have occurred.
//            //
//
//        }
//    }
//    //
//    // Check if the cause is the CAN-B receive message object 1. Will be skipped
//    // in the first iteration of every ISR execution
//    //
//    else if(status == RX_MSG_OBJ_ID)
//    {
//        //
//        // Get the received message
//        //
//        CAN_readMessage(CANB_BASE, RX_MSG_OBJ_ID, rxMsgData);
//
//        //
//        // Getting to this point means that the RX interrupt occurred on
//        // message object 1, and the message RX is complete.  Clear the
//        // message object interrupt.
//        //
//        CAN_clearInterruptStatus(CANB_BASE, RX_MSG_OBJ_ID);
//
//        //
//        // Increment a counter to keep track of how many messages have been
//        // received. In a real application this could be used to set flags to
//        // indicate when a message is received.
//        //
//
//    }
//
////    else if(status == RX_MSG_OBJ_ID1)
////        {
////            //
////            // Get the received message
////            //
////            CAN_readMessage(CANB_BASE, RX_MSG_OBJ_ID1, rxMsgData1);
////
////            //
////            // Getting to this point means that the RX interrupt occurred on
////            // message object 1, and the message RX is complete.  Clear the
////            // message object interrupt.
////            //
////            CAN_clearInterruptStatus(CANB_BASE, RX_MSG_OBJ_ID1);
////
////            //
////            // Increment a counter to keep track of how many messages have been
////            // received. In a real application this could be used to set flags to
////            // indicate when a message is received.
////            //
////
////        }
//    //
//    // If something unexpected caused the interrupt, this would handle it.
//    //
//    else
//    {
//        //
//        // Spurious interrupt handling can go here.
//        //
//    }
//
//    //
//    // Clear the global interrupt flag for the CAN interrupt line
//    //
//    CAN_clearGlobalInterruptStatus(CANB_BASE, CAN_GLOBAL_INT_CANINT0);
//
//    //
//    // Acknowledge this interrupt located in group 9
//    //
//    Interrupt_clearACKGroup(INTERRUPT_ACK_GROUP9);
//}
